<?php

/**
 * PlanPagoAgua form base class.
 *
 * @method PlanPagoAgua getObject() Returns the current form's model object
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePlanPagoAguaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'fecha'               => new sfWidgetFormDateTime(),
      'totalinteres'        => new sfWidgetFormInputText(),
      'totalrecargo'        => new sfWidgetFormInputText(),
      'valor_cuota'         => new sfWidgetFormInputText(),
      'periodo_desde'       => new sfWidgetFormDate(),
      'cantidad_cuotas'     => new sfWidgetFormInputText(),
      'estado'              => new sfWidgetFormChoice(array('choices' => array('DEBE' => 'DEBE', 'PAGADO' => 'PAGADO', 'ANULADO' => 'ANULADO'))),
      'obs'                 => new sfWidgetFormInputText(),
      'unidad_funcional_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFuncional'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'fecha'               => new sfValidatorDateTime(),
      'totalinteres'        => new sfValidatorNumber(),
      'totalrecargo'        => new sfValidatorNumber(),
      'valor_cuota'         => new sfValidatorNumber(),
      'periodo_desde'       => new sfValidatorDate(),
      'cantidad_cuotas'     => new sfValidatorInteger(),
      'estado'              => new sfValidatorChoice(array('choices' => array(0 => 'DEBE', 1 => 'PAGADO', 2 => 'ANULADO'), 'required' => false)),
      'obs'                 => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'unidad_funcional_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFuncional'))),
    ));

    $this->widgetSchema->setNameFormat('plan_pago_agua[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PlanPagoAgua';
  }

}
